package com.dsx.haha.servicempl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.dsx.haha.mapper.UserMapper;
import com.dsx.haha.model.entity.Article;
import com.dsx.haha.model.entity.Role;
import com.dsx.haha.model.entity.User;
import com.dsx.haha.service.UserService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;


/**
 * @author dsx
 * @date 2021/3/11 13:27
 * @since JDK1.8
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService {
    @Autowired
    UserMapper userMapper;
    
    
    @Override
    public UserMapper getUserMapper(){
        return userMapper;
    }

    @Override
    public User addUser() {
        return null;
    }

    @Override
    public String getUserId(String username) {
        return userMapper.getUserId(username);
    }

    @Override
    public User getUser(String username) {
        return userMapper.getUser(username);
    }

    @Override
    public List<String> getUserRoles(String id) {
        return userMapper.getUserRoles(id);
    }

    

    @Override
    public List<Map> getUserTenants(String id) {
        return userMapper.getUserTenants(id);
    }

    @Override
    public List<Article> getArtByTenantId(String id) {
        return userMapper.getArtByTenantId(id);
    }

    //用户是租户管理员时，能够查看自己所有的租户信息
    @Override
    public List<Map> getAdminTenants(String id) {
        return userMapper.getAdminTenants(id);
    }
}
